3.241 \(\int \tan (c+d x) (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\)
Optimal. Leaf size=112 \[ -\frac {\left (a^2 A-2 a b B-A b^2\right ) \log (\cos (c+d x))}{d}-x \left (a^2 B+2 a A b-b^2 B\right )+\frac {b (a A-b B) \tan (c+d x)}{d}+\frac {A (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 b d} \]
[Out]
-(2*A*a*b+B*a^2-B*b^2)*x-(A*a^2-A*b^2-2*B*a*b)*ln(cos(d*x+c))/d+b*(A*a-B*b)*tan(d*x+c)/d+1/2*A*(a+b*tan(d*x+c)
)^2/d+1/3*B*(a+b*tan(d*x+c))^3/b/d
________________________________________________________________________________________
Rubi [A] time = 0.12, antiderivative size = 112, normalized size of antiderivative = 1.00,
number of steps used = 4, number of rules used = 4, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used =
{3592, 3528, 3525, 3475} \[ -\frac {\left (a^2 A-2 a b B-A b^2\right ) \log (\cos (c+d x))}{d}-x \left (a^2 B+2 a A b-b^2 B\right )+\frac {b (a A-b B) \tan (c+d x)}{d}+\frac {A (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 b d} \]
Antiderivative was successfully verified.
[In]
Int[Tan[c + d*x]*(a + b*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
[Out]
-((2*a*A*b + a^2*B - b^2*B)*x) - ((a^2*A - A*b^2 - 2*a*b*B)*Log[Cos[c + d*x]])/d + (b*(a*A - b*B)*Tan[c + d*x]
)/d + (A*(a + b*Tan[c + d*x])^2)/(2*d) + (B*(a + b*Tan[c + d*x])^3)/(3*b*d)
Rule 3475
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]
Rule 3525
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
Rule 3528
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]
Rule 3592
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(B*d*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e
+ f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] && !LeQ[m, -1]
Rubi steps
\begin {align*} \int \tan (c+d x) (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {B (a+b \tan (c+d x))^3}{3 b d}+\int (-B+A \tan (c+d x)) (a+b \tan (c+d x))^2 \, dx\\ &=\frac {A (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 b d}+\int (a+b \tan (c+d x)) (-A b-a B+(a A-b B) \tan (c+d x)) \, dx\\ &=-\left (2 a A b+a^2 B-b^2 B\right ) x+\frac {b (a A-b B) \tan (c+d x)}{d}+\frac {A (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 b d}+\left (a^2 A-A b^2-2 a b B\right ) \int \tan (c+d x) \, dx\\ &=-\left (2 a A b+a^2 B-b^2 B\right ) x-\frac {\left (a^2 A-A b^2-2 a b B\right ) \log (\cos (c+d x))}{d}+\frac {b (a A-b B) \tan (c+d x)}{d}+\frac {A (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 1.79, size = 172, normalized size = 1.54 \[ \frac {3 (a A+b B) \left (-2 b^2 \tan (c+d x)+i \left ((a+i b)^2 \log (-\tan (c+d x)+i)-(a-i b)^2 \log (\tan (c+d x)+i)\right )\right )+3 A \left (6 a b^2 \tan (c+d x)+(-b+i a)^3 \log (-\tan (c+d x)+i)-(b+i a)^3 \log (\tan (c+d x)+i)+b^3 \tan ^2(c+d x)\right )+2 B (a+b \tan (c+d x))^3}{6 b d} \]
Antiderivative was successfully verified.
[In]
Integrate[Tan[c + d*x]*(a + b*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
[Out]
(2*B*(a + b*Tan[c + d*x])^3 + 3*(a*A + b*B)*(I*((a + I*b)^2*Log[I - Tan[c + d*x]] - (a - I*b)^2*Log[I + Tan[c
+ d*x]]) - 2*b^2*Tan[c + d*x]) + 3*A*((I*a - b)^3*Log[I - Tan[c + d*x]] - (I*a + b)^3*Log[I + Tan[c + d*x]] +
6*a*b^2*Tan[c + d*x] + b^3*Tan[c + d*x]^2))/(6*b*d)
________________________________________________________________________________________
fricas [A] time = 0.72, size = 119, normalized size = 1.06 \[ \frac {2 \, B b^{2} \tan \left (d x + c\right )^{3} - 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} d x + 3 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )^{2} - 3 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \tan \left (d x + c\right )}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
integrate(tan(d*x+c)*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")
[Out]
1/6*(2*B*b^2*tan(d*x + c)^3 - 6*(B*a^2 + 2*A*a*b - B*b^2)*d*x + 3*(2*B*a*b + A*b^2)*tan(d*x + c)^2 - 3*(A*a^2
- 2*B*a*b - A*b^2)*log(1/(tan(d*x + c)^2 + 1)) + 6*(B*a^2 + 2*A*a*b - B*b^2)*tan(d*x + c))/d
________________________________________________________________________________________
giac [B] time = 1.80, size = 1509, normalized size = 13.47 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
integrate(tan(d*x+c)*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")
[Out]
-1/6*(6*B*a^2*d*x*tan(d*x)^3*tan(c)^3 + 12*A*a*b*d*x*tan(d*x)^3*tan(c)^3 - 6*B*b^2*d*x*tan(d*x)^3*tan(c)^3 + 3
*A*a^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c)
+ 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 - 6*B*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x
)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 - 3*A*b^2*log(4*(tan(d*
x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)
)*tan(d*x)^3*tan(c)^3 - 18*B*a^2*d*x*tan(d*x)^2*tan(c)^2 - 36*A*a*b*d*x*tan(d*x)^2*tan(c)^2 + 18*B*b^2*d*x*tan
(d*x)^2*tan(c)^2 - 6*B*a*b*tan(d*x)^3*tan(c)^3 - 3*A*b^2*tan(d*x)^3*tan(c)^3 - 9*A*a^2*log(4*(tan(d*x)^4*tan(c
)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)
^2*tan(c)^2 + 18*B*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2
*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 + 9*A*b^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*
tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 + 6*B*a
^2*tan(d*x)^3*tan(c)^2 + 12*A*a*b*tan(d*x)^3*tan(c)^2 - 6*B*b^2*tan(d*x)^3*tan(c)^2 + 6*B*a^2*tan(d*x)^2*tan(c
)^3 + 12*A*a*b*tan(d*x)^2*tan(c)^3 - 6*B*b^2*tan(d*x)^2*tan(c)^3 + 18*B*a^2*d*x*tan(d*x)*tan(c) + 36*A*a*b*d*x
*tan(d*x)*tan(c) - 18*B*b^2*d*x*tan(d*x)*tan(c) - 6*B*a*b*tan(d*x)^3*tan(c) - 3*A*b^2*tan(d*x)^3*tan(c) + 6*B*
a*b*tan(d*x)^2*tan(c)^2 + 3*A*b^2*tan(d*x)^2*tan(c)^2 - 6*B*a*b*tan(d*x)*tan(c)^3 - 3*A*b^2*tan(d*x)*tan(c)^3
+ 2*B*b^2*tan(d*x)^3 + 9*A*a^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*
x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) - 18*B*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*
x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) - 9*A*
b^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) +
1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) - 12*B*a^2*tan(d*x)^2*tan(c) - 24*A*a*b*tan(d*x)^2*tan(c) + 18*B*b^2*tan(d*
x)^2*tan(c) - 12*B*a^2*tan(d*x)*tan(c)^2 - 24*A*a*b*tan(d*x)*tan(c)^2 + 18*B*b^2*tan(d*x)*tan(c)^2 + 2*B*b^2*t
an(c)^3 - 6*B*a^2*d*x - 12*A*a*b*d*x + 6*B*b^2*d*x + 6*B*a*b*tan(d*x)^2 + 3*A*b^2*tan(d*x)^2 - 6*B*a*b*tan(d*x
)*tan(c) - 3*A*b^2*tan(d*x)*tan(c) + 6*B*a*b*tan(c)^2 + 3*A*b^2*tan(c)^2 - 3*A*a^2*log(4*(tan(d*x)^4*tan(c)^2
- 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)) + 6*B*a*b*lo
g(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(ta
n(c)^2 + 1)) + 3*A*b^2*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2
*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)) + 6*B*a^2*tan(d*x) + 12*A*a*b*tan(d*x) - 6*B*b^2*tan(d*x) + 6*B*a^2*tan(
c) + 12*A*a*b*tan(c) - 6*B*b^2*tan(c) + 6*B*a*b + 3*A*b^2)/(d*tan(d*x)^3*tan(c)^3 - 3*d*tan(d*x)^2*tan(c)^2 +
3*d*tan(d*x)*tan(c) - d)
________________________________________________________________________________________
maple [A] time = 0.02, size = 199, normalized size = 1.78 \[ \frac {B \left (\tan ^{3}\left (d x +c \right )\right ) b^{2}}{3 d}+\frac {A \left (\tan ^{2}\left (d x +c \right )\right ) b^{2}}{2 d}+\frac {B \left (\tan ^{2}\left (d x +c \right )\right ) a b}{d}+\frac {2 a A b \tan \left (d x +c \right )}{d}+\frac {a^{2} B \tan \left (d x +c \right )}{d}-\frac {b^{2} B \tan \left (d x +c \right )}{d}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2} A}{2 d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) A \,b^{2}}{2 d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) B a b}{d}-\frac {2 A \arctan \left (\tan \left (d x +c \right )\right ) a b}{d}-\frac {B \arctan \left (\tan \left (d x +c \right )\right ) a^{2}}{d}+\frac {B \arctan \left (\tan \left (d x +c \right )\right ) b^{2}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
int(tan(d*x+c)*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)
[Out]
1/3/d*B*tan(d*x+c)^3*b^2+1/2/d*A*tan(d*x+c)^2*b^2+1/d*B*tan(d*x+c)^2*a*b+2*a*A*b*tan(d*x+c)/d+a^2*B*tan(d*x+c)
/d-b^2*B*tan(d*x+c)/d+1/2/d*ln(1+tan(d*x+c)^2)*a^2*A-1/2/d*ln(1+tan(d*x+c)^2)*A*b^2-1/d*ln(1+tan(d*x+c)^2)*B*a
*b-2/d*A*arctan(tan(d*x+c))*a*b-1/d*B*arctan(tan(d*x+c))*a^2+1/d*B*arctan(tan(d*x+c))*b^2
________________________________________________________________________________________
maxima [A] time = 1.14, size = 120, normalized size = 1.07 \[ \frac {2 \, B b^{2} \tan \left (d x + c\right )^{3} + 3 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} {\left (d x + c\right )} + 3 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \tan \left (d x + c\right )}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
integrate(tan(d*x+c)*(a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")
[Out]
1/6*(2*B*b^2*tan(d*x + c)^3 + 3*(2*B*a*b + A*b^2)*tan(d*x + c)^2 - 6*(B*a^2 + 2*A*a*b - B*b^2)*(d*x + c) + 3*(
A*a^2 - 2*B*a*b - A*b^2)*log(tan(d*x + c)^2 + 1) + 6*(B*a^2 + 2*A*a*b - B*b^2)*tan(d*x + c))/d
________________________________________________________________________________________
mupad [B] time = 6.21, size = 121, normalized size = 1.08 \[ \frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {A\,b^2}{2}+B\,a\,b\right )}{d}-x\,\left (B\,a^2+2\,A\,a\,b-B\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a^2+2\,A\,a\,b-B\,b^2\right )}{d}-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (-\frac {A\,a^2}{2}+B\,a\,b+\frac {A\,b^2}{2}\right )}{d}+\frac {B\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
int(tan(c + d*x)*(A + B*tan(c + d*x))*(a + b*tan(c + d*x))^2,x)
[Out]
(tan(c + d*x)^2*((A*b^2)/2 + B*a*b))/d - x*(B*a^2 - B*b^2 + 2*A*a*b) + (tan(c + d*x)*(B*a^2 - B*b^2 + 2*A*a*b)
)/d - (log(tan(c + d*x)^2 + 1)*((A*b^2)/2 - (A*a^2)/2 + B*a*b))/d + (B*b^2*tan(c + d*x)^3)/(3*d)
________________________________________________________________________________________
sympy [A] time = 0.42, size = 192, normalized size = 1.71 \[ \begin {cases} \frac {A a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 A a b x + \frac {2 A a b \tan {\left (c + d x \right )}}{d} - \frac {A b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} - B a^{2} x + \frac {B a^{2} \tan {\left (c + d x \right )}}{d} - \frac {B a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {B a b \tan ^{2}{\left (c + d x \right )}}{d} + B b^{2} x + \frac {B b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {B b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right )^{2} \tan {\relax (c )} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
integrate(tan(d*x+c)*(a+b*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)
[Out]
Piecewise((A*a**2*log(tan(c + d*x)**2 + 1)/(2*d) - 2*A*a*b*x + 2*A*a*b*tan(c + d*x)/d - A*b**2*log(tan(c + d*x
)**2 + 1)/(2*d) + A*b**2*tan(c + d*x)**2/(2*d) - B*a**2*x + B*a**2*tan(c + d*x)/d - B*a*b*log(tan(c + d*x)**2
+ 1)/d + B*a*b*tan(c + d*x)**2/d + B*b**2*x + B*b**2*tan(c + d*x)**3/(3*d) - B*b**2*tan(c + d*x)/d, Ne(d, 0)),
(x*(A + B*tan(c))*(a + b*tan(c))**2*tan(c), True))
________________________________________________________________________________________